home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / apidev / whohas.arc / WHOHAS.DOC < prev    next >
Text File  |  1989-04-03  |  3KB  |  52 lines

  1. Article: WHOHAS the File I Need?
  2.  
  3. (Author Note: This is a pre-edit version of the whohas article that
  4. appeared in the January Netware Technical Journal.  It is, however, the
  5. only documentation written for this program, so here it is.)
  6.  
  7. In a recent article in LAN Times, a survey was done of software
  8. packages that are written specifically to Netware.  In this survey of
  9. features, one capability was mentioned that very few of the programs
  10. had.  It was the ability for a user to find out quickly and easily who
  11. else on the LAN might be using a particular file.  With an increase in
  12. the usage of networks for file sharing comes an associated increase in
  13. the probability of a collision, or concurrent attempted file access. 
  14. For this issue's slice o' code I have written a small utility to
  15. provide users quickly with information about which other users are
  16. accessing a file.
  17.  
  18. This utility, named "WhoHas", tells you exactly what its name implies. 
  19. It gives you the user name associated with every connection at the file
  20. server that currently has the file open.  For instance if you try to
  21. edit a file only to have your word processor report back that the file
  22. is "locked" or "in use", then you could use this utility to find out
  23. exactly who was using the file.  As an added extra, I included the
  24. capability to send a short message to everyone using the file. 
  25. Something like "Get out or else!" can be sent to let other users know
  26. you need to access the file as soon as possible.
  27.  
  28. The program consists of four main sections: parsing the filename to
  29. prepare for the informational call, the actual loop using a virtual
  30. console call to get the connection numbers, displaying the user names
  31. for the connections, and finally sending a message if requested to. 
  32. The only call which may involve a little explanation is the
  33. GetConnectionsUsingFile function.  (This is a new function in the
  34. recently released Network C libraries.)  It returns a structure
  35. (specified by CONN_USING_FILE) with both summary information and
  36. connection-specific information.  Multiple calls will return additional
  37. specific information, but the summary information will remain the same
  38. (unless, of course, the file usage changes).  The two variables
  39. lastRecord and taskID are used internally by the function to determine
  40. whether subsequent requests need to be made to the server, and which
  41. buffer number inside a particular reply to return to the caller. 
  42. Setting them to zero initially is all that need be done by the user
  43. program.
  44.  
  45. This is just one example of a short utility to provide added
  46. information about the network environment.  I'm sure that there are
  47. many other value-added utilities waiting to be written.  With the
  48. inclusion in the C libraries of support for more of the virtual console
  49. and extended function calls, hopefully the network environment can be
  50. more easily enriched with programs and utilites that tap the
  51. information and services offered by Novell LANs.
  52.